package cn.itcast.mapper;


import cn.itcast.pojo.Student;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper extends BaseMapper<Student> {


    /*List<Student> search(@Param("name") String name, @Param("degree") Integer degree, @Param("clazzId") Integer clazzId);

    Integer deleteByIds(@Param("list") List<Integer> ids);

    @Insert("insert into student (name, no, gender, phone, id_card, is_college, address, degree, graduation_date, clazz_id, violation_count, violation_score, create_time, update_time) values (#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{violationCount},#{violationScore},#{createTime},#{updateTime})")
    Integer insertStudent(Student student);

    @Select("select * from student where id = #{id}")
    Student selectById(@Param("id") Integer id);

    @Update("update student set name = #{name},no = #{no},gender = #{gender},phone = #{phone},id_card = #{idCard},is_college = #{isCollege},address = #{address},degree = #{degree},graduation_date = #{graduationDate},clazz_id = #{clazzId},violation_count = #{violationCount},violation_score = #{violationScore},update_time=#{updateTime} where id = #{id}")
    Integer updateStudent(Student student);

    @Select("select count(*) from student where clazz_id = #{id}")
    Integer selectByIdCount(Integer id);

    @Update("update student set violation_score = violation_score + #{score} , violation_count = violation_count+1 where id = #{id}")
    Integer updateScore(@Param("id") Integer id, @Param("score") Integer score);

    @Update("update student set violation_score = violation_score + #{score}  where id = #{id}")
    Integer updateScore1(@Param("id") Integer id, @Param("score") Integer score);*/

}
